import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ResourcesSchoolVO, ResourcesSchoolForm, ResourcesSchoolQuery } from '@/api/core/resourcesSchool/types';

/**
 * 查询教学资源管理学校库列表
 * @param query
 * @returns {*}
 */

export const listResourcesSchool = (query?: ResourcesSchoolQuery): AxiosPromise<ResourcesSchoolVO[]> => {
  return request({
    url: '/core/resourcesSchool/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询教学资源管理学校库详细
 * @param id
 */
export const getResourcesSchool = (id: string | number): AxiosPromise<ResourcesSchoolVO> => {
  return request({
    url: '/core/resourcesSchool/' + id,
    method: 'get'
  });
};

/**
 * 新增教学资源管理学校库
 * @param data
 */
export const addResourcesSchool = (data: ResourcesSchoolForm) => {
  return request({
    url: '/core/resourcesSchool',
    method: 'post',
    data: data
  });
};

/**
 * 修改教学资源管理学校库
 * @param data
 */
export const updateResourcesSchool = (data: ResourcesSchoolForm) => {
  return request({
    url: '/core/resourcesSchool',
    method: 'put',
    data: data
  });
};

/**
 * 删除教学资源管理学校库
 * @param id
 */
export const delResourcesSchool = (id: string | number | Array<string | number>) => {
  return request({
    url: '/core/resourcesSchool/' + id,
    method: 'delete'
  });
};
